package com.example.springdemo81;

import bean.Customer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class Springdemo81Application {

    public static void main(String[] args) {
        SpringApplication.run(Springdemo81Application.class, args);
        ApplicationContext context = new ClassPathXmlApplicationContext("myConfig.xml");
        Customer customer = (Customer) context.getBean("cu");
        System.out.println("customer:id=" + customer.getId() + "name=" +
                customer.getName()+ "passwprd="+customer.getPassord());
    }

    @GetMapping("/spring")
    public String sayHello() {
        return "hello spring ";
    }
}
